import 'package:elephant_fish/http/request/anchor_recommend_request.dart';
import 'package:elephant_fish/http/request/base_request.dart';
import 'package:elephant_fish/model/anchor_entity.dart';
import 'package:elephant_fish/page/login_page.dart';
import 'package:elephant_fish/util/size_util.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';

class SearchAppBar extends StatefulWidget {
  const SearchAppBar({Key key}) : super(key: key);

  @override
  _SearchAppBarState createState() => _SearchAppBarState();
}

class _SearchAppBarState extends State<SearchAppBar> {
  @override
  Widget build(BuildContext context) {
    //横向布局
    return Row(
      children: <Widget>[
        //因为它是左右占比结构,所以使用Expanded 的flex
        Expanded(
          flex: 1,
          child: InkWell(
            //利用InkWell组件包裹其他组件,则拥有了点击事件
              child: Container(
                //所有组件垂直居中
                alignment: Alignment.center,
                height: SizeUtil.px(56),
                padding: EdgeInsets.fromLTRB(0, 0, SizeUtil.px(30), 0),
                //带有弧度的边框,有背景色
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(53),
                  color: Color(0xff2b244d),
                ),
                child: Stack(
                  alignment: Alignment.center,
                  children: <Widget>[
                    Row(
                      //常用于Row和Column控件
                      mainAxisAlignment: MainAxisAlignment.start,
                      children: <Widget>[
                        SizedBox(width: SizeUtil.px(20)),
                        Icon(Icons.search, color: Color(0xff59527a)),
                        SizedBox(width: SizeUtil.px(20)), //常用于两个组件之间的分隔
                        Expanded(
                            child:TextField(
                              decoration: InputDecoration(
                                isCollapsed: true,
                                contentPadding: EdgeInsets.all(0),
                                border: InputBorder.none,
                                hintText: '@Make',
                                hintStyle: TextStyle(color: Color(0xff59527a)),
                              ),
                              style: TextStyle(color: Color(0xff59527a)),
                            ) )
                      ],
                    ),
                  ],
                ),
              )),
        ),
        SizedBox(width: SizeUtil.px(14)),
        Expanded(
            flex: 0,
            child: InkWell(
              child: Text(
                '搜索',style: TextStyle(fontSize: SizeUtil.px(32),color: Color(0xffffffff)),
              ),
              onTap: (){
              },
            )
        ),
      ],
    );
  }


}

